<extend name="Public/base"/>


<block name="body">
    <!-- 根据方法名称确定载入哪个模版 -->
    <if condition="ACTION_NAME eq 'edit'">
        <include file="Public/edit" />
        <else />
        <include file="Public/create" />
    </if>
</block>

<block name="script">
    <script>
    $(document).ready(function(){
        var $cats_select = $("select[name='cat_id']");

        {$cats}.forEach(function(cate){
            var html='<option value="'+cate.id+'" ';
            var selectId = '{$data.cat_id}';
            if(cate.id == selectId){
                html += 'selected';
            }
             html+= '>'+cate.title+'</option>';

            $cats_select.append(html);
        });

    });
    </script>
</block>